#!/usr/bin/env python
#_*_ coding:utf-8 _*_
from __future__ import unicode_literals

from django.db import models

# Create your models here.
class UserType(models.Model):
    name=models.CharField(max_length=50)


class UserInfo(models.Model):
    username=models.CharField(max_length=36)
    password=models.CharField(max_length=36)
    email=models.EmailField()
    create_time=models.DateTimeField(auto_now=True, null=True)
    #用户表和用户类型表是：一对多
    user_type=models.ForeignKey('UserType')
    
class UserGroup(models.Model):
    groupname=models.CharField(max_length=50)
    user=models.ManyToManyField("UserInfo")

class Asset(models.Model):
    hostname=models.CharField(max_length=256)
    ip=models.GenericIPAddressField()
    user_group=models.ForeignKey('UserGroup')